//
//  FlutterOpenglViewFactory.swift
//  flutter_test_opengl_plugin
//
//  Created by yuanxc on 2024/5/23.
//

import Foundation
import Flutter

class FlutterOpenglViewFactory: NSObject, FlutterPlatformViewFactory {
    private var message : FlutterBinaryMessenger;

    init(message : FlutterBinaryMessenger) {
        self.message = message;
    }

    func createArgsCodec() -> FlutterMessageCodec & NSObjectProtocol {
        FlutterStandardMessageCodec.sharedInstance()
    }

    func create(withFrame frame: CGRect, viewIdentifier viewId: Int64, arguments args: Any?) -> FlutterPlatformView {
        let openGlView = FlutterOpenGlView(frame: frame, viewId: viewId, arguments: args, message: message)
        return openGlView
    }
}
